package com.radiant.data.entity;

import javax.xml.bind.annotation.XmlRootElement;

import com.radiant.data.annotation.Entity;
import com.radiant.data.annotation.Persist;
import com.radiant.data.entity.DevelopmentTrack.TrackItem;

@XmlRootElement
@Entity(name="Milestone")
public class Milestone extends WallEntity implements ActivityFeedable {
	
	@Persist(name="milestoneId", itemName=true)
	private String milestoneId;

	@Persist(name="childId")
	private String childId;
	
	@Persist(name="month")
	private Month month;
	
	@Persist(name="trackItem")
	private TrackItem trackItem;

	public String getMilestoneId() {
		return milestoneId;
	}

	public void setMilestoneId(String milestoneId) {
		this.milestoneId = milestoneId;
	}

	public String getChildId() {
		return childId;
	}

	public void setChildId(String childId) {
		this.childId = childId;
	}

	public Month getMonth() {
		return month;
	}

	public void setMonth(Month month) {
		this.month = month;
	}

	public TrackItem getTrackItem() {
		return trackItem;
	}

	public void setTrackItem(TrackItem trackItem) {
		this.trackItem = trackItem;
	}

	public void addToActivity(Activity activity) {
		activity.setMilestone(this);
		
	}

	public void addMessageToActivity(Activity activity, User creator,
			Child child) {
		StringBuffer sb = new StringBuffer();
		sb.append(creator.getUserName()).append(" recorded a new milestone for ");
		sb.append(child.getName());
		activity.setMessage(sb.toString());
	}

}
